/** @file main.qml
@brief Qt-Complex test application for Harmattan Meego 1.2

@authorname \n
@licenseversion \n
@actualversion - @dateupdate

@licensenote

@mainpage The Qt-Quick QML Framework for developers
Qt-Complex for Harmattan is a complete framework for the creation of Qt-Quick QML user interfaces
with customizable objects.
From the application the users access to the wiki documentation and installation information.
The test program is an example of a Qt-Complex based UI. Following the application links
the user can access to the download area of the development package
hosted on https://projects.developer.nokia.com/Qt_Complex This version of the application
and the Qt-Complex framework are distributed under the open source LGPL 3.0 license.
*/

import QtQuick 1.1
import com.meego 1.0
import "QtComplex" as Framework
import "QtComplex/Geometry.js" as Geometry
import "QtComplex/TestApplication.js" as Test

PageStackWindow {
    id: appWindow

    initialPage: mainPage

    MainPage{id: mainPage}

    // Open a page and push it in the stack
    function openFile(file) {
        // Create the Qt component based on the file/qml page to load.
        var component = Qt.createComponent(file)
        // If the page is ready to be managed it is pushed onto the stack
        if (component.status == Component.Ready)
            pageStack.push(component);
        else
            console.log("Error loading: " + component.errorString());
    }

    ToolBarLayout {
        id: commonTools
        visible: true
        ToolIcon {
            iconId: "toolbar-back";
            onClicked: { pageStack.pop(); }
        }
        ToolIcon {
            platformIconId: "toolbar-view-menu";
             anchors.right: parent===undefined ? undefined : parent.right
             onClicked: (myMenu.status == DialogStatus.Closed) ? myMenu.open() : myMenu.close()
        }
    }

    Menu {
        id: myMenu
        visualParent: pageStack
        MenuLayout {
            MenuItem {
                text: "Qt-Complex 1.0 Harmattan"
                onClicked: openFile("MainUrl.qml");
            }
            MenuItem {
                text: "Wiki pages"
                onClicked: openFile("WikiPage.qml");
            }
            MenuItem {
                text: "Framework sources"
                onClicked: openFile("SourcePage.qml");
            }
            MenuItem {
                text: "Sample page"
                onClicked: openFile("SamplePage.qml");
            }
        }
    }
}
